#pragma once
#include "State.h"
template <class T> class FiniteStateMachine
{
public:
	FiniteStateMachine(T *aActor){
		mActor=aActor;
	}
	~FiniteStateMachine(void){}
	T * mActor;
	State * mCurrState;
	State * mPrevState;

	void Start(State * aInitialState)
	{
		mPrevState=nullptr;
		mCurrState=aInitialState;
	}

	void Execute()
	{
		mCurrState->Execute(this);
	}

	void ChangeState(State *aNextState)
	{
		delete mPrevState;
		mPrevState=mCurrState;
		mCurrState=aNextState;
	}
};

